package com.dongdong.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdong.mapper.TbItemMapper;
import com.dongdong.pojo.TbItem;
import com.dongdong.pojo.TbItemExample;
import com.dongdong.service.ItemCatService;
import com.dongdong.service.ItemService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Deacription TODO
 * @Author Lenovo
 * @Date 2020/12/15 11:08
 * @Version 1.0
 **/
@Component
@Service
public class ItemServiceImpl implements ItemService {

    @Resource
    private TbItemMapper itemMapper;

    @Override
    public List<TbItem> findItemListByGoodsId(Long goodsId) {
        TbItemExample example = new TbItemExample();
        TbItemExample.Criteria criteria = example.createCriteria();
        criteria.andGoodsIdEqualTo(goodsId);
        return itemMapper.selectByExample(example);
    }


    @Override
    public TbItem findItemById(Long itemId) {
        return itemMapper.selectByPrimaryKey(itemId);
    }
}

